;************************************ ;Project title: Christmas Star * ;Version 1: 1.0 * ;Written By: MSH * ;Dated: 18/09/05 * ;For PIC: PIC16F84A * ;Clock Freq: 8.0MHz * ;************************************ ; PROGRAM FUNCTION:___________________________ ;_____________________________________________ List P=16F84A include ;============ ; Declarations: porta equ 05 portb equ 06 mark64 equ 0C mark24 equ 0D mark16 equ 0E mark4 equ 10 post75 equ 11 post40 equ 12 post30 equ 13 post18 equ 14 post8 equ 15 post5 equ 16 post4 equ 17 post4a equ 18 post3 equ 19 org 0 goto Start ;============ ; Subroutines: Init clrf porta ; resets Port A and B. clrf portb ; bsf STATUS,5 ; selects bank 1 movlw b'01111' ; RA0 = SW1, RA1 = SW2, movwf TRISA ; RA2 = SW3, RA3 = SW3. movlw b'00000000' ; RB0-RB7 = Transistor outputs for controlling movwf TRISB ; the LEDs. movlw b'00000111' ; TMR0 prescaled by 256 movwf OPTION_REG ; pull ups disabled. bcf STATUS, 5 ; Selects bank 0 movlw b'00000000' ; disables all interrupts. movwf INTCON ; movlw d'64' ; moves the decimal No64 into the GPF called movwf mark64 ; mark64, the marker for one952sec16. movlw d'24' ; moves the decimal No24 into the GPF called movwf mark24 ; mark24, the marker for one952sec6. movlw d'16' ; moves the decimal No16 into the GPF called movwf mark16 ; mark16, the marker for one952sec4. movlw d'4' ; moves the decimal No4 into the GPF called mark4. movwf mark4 ; mark4, the marker for one952sec. call resetpost75 ; resets post75 register. call resetpost40 ; resets post40 register. call resetpost30 ; resets post30 register. call resetpost18 ; resets post18 register. call resetpost8 ; resets post8 register. call resetpost5 ; resets post5 register. call resetpost4 ; resets post4 register. call resetpost3 ; resets post3 register. movlw d'4' ; moves the decimal No4 into the GPF called movwf post4a ; post4a. retlw 0 one952sec clrf TMR0 ; resets TMR0. one952sec1 movfw mark4 ; takes the number out of mark4. subwf TMR0,w ; subtracts this number from the number ; in TMR0, leaving the result in the ; working register (and leaving TMR0 unchanged). btfss STATUS,Z ; tests the zero flag - skip if set i.e. if the ; result is zero it will skip the next instruction. goto one952sec1 ; loops to one952sec1. return ; returns from subroutine. one952sec4 clrf TMR0 ; resets TMR0. one952sec4_1 movfw mark16 ; takes the number out of mark16. subwf TMR0,w ; subtracts this number from the number ; in TMR0, leaving the result in the ; working register (and leaving TMR0 unchanged) btfss STATUS,Z ; tests the zero flag - skip if set i.e. if the ; result is zero it will skip the next instruction. goto one952sec4_1 ; loops to one952sec4_1. return ; returns from subroutine. one952sec5 call one952sec ; creates a 1/1952sec delay. call one952sec4 ; creates a 4/1952sec delay. return ; returns from subroutine. one952sec6 clrf TMR0 ; resets TMR0. one952sec6_1 movfw mark24 ; takes the number out of mark24. subwf TMR0,w ; subtracts this number from the number ; in TMR0, leaving the result in the ; working register (and leaving TMR0 unchanged) btfss STATUS,Z ; tests the zero flag - skip if set i.e. if the ; result is zero it will skip the next instruction. goto one952sec6_1 ; loops to one952sec6_1. return ; returns from subroutine. one952sec10 call one952sec6 ; creates a 6/1952sec delay. call one952sec4 ; creates a 4/1952sec delay. return one952sec12 call one952sec6 ; creates a 6/1952sec delay. call one952sec6 ; creates a 6/1952sec delay. return ; returns from subroutine. one952sec16 clrf TMR0 ; resets TMR0. one952sec16_1 movfw mark64 ; takes the number out of mark64. subwf TMR0,w ; subtracts this number from the number ; in TMR0, leaving the result in the ; working register (and leaving TMR0 unchanged) btfss STATUS,Z ; tests the zero flag - skip if set i.e. if the ; result is zero it will skip the next instruction. goto one952sec16_1 ; loops to one952sec16_1. return ; returns from subroutine. one952sec18 call one952sec6 ; creates a 6/1952sec delay. call one952sec6 ; creates a 6/1952sec delay. call one952sec6 ; creates a 6/1952sec delay. return ; returns from subroutine. ledd1 movlw b'00010001' ; moves code into portb to switch D1 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd2 movlw b'00100001' ; moves code into portb to switch D2 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd3 movlw b'01000001' ; moves code into portb to switch D3 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd4 movlw b'10000001' ; moves code into portb to switch D4 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd5 movlw b'00000001' ; moves code into portb to switch D5 on. movwf portb ; bcf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd6 movlw b'00010010' ; moves code into portb to switch D6 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd7 movlw b'00100010' ; moves code into portb to switch D7 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd8 movlw b'01000010' ; moves code into portb to switch D8 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd9 movlw b'10000010' ; moves code into portb to switch D9 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd10 movlw b'00000010' ; moves code into portb to switch D10 on. movwf portb ; bcf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd11 movlw b'00010100' ; moves code into portb to switch D11 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd12 movlw b'00100100' ; moves code into portb to switch D12 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd13 movlw b'01000100' ; moves code into portb to switch D13 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd14 movlw b'10000100' ; moves code into portb to switch D14 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd15 movlw b'00000100' ; moves code into portb to switch D15 on. movwf portb ; bcf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd16 movlw b'00011000' ; moves code into portb to switch D16 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd17 movlw b'00101000' ; moves code into portb to switch D17 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd18 movlw b'01001000' ; moves code into portb to switch D18 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd19 movlw b'10001000' ; moves code into portb to switch D19 on. movwf portb ; bsf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. ledd20 movlw b'00001000' ; moves code into portb to switch D20 on. movwf portb ; bcf porta,4 ; call one952sec ; creates a 1/1952sec delay. clrf portb ; switches LEDs off. return ; returns from subroutine. oranges call ledd16 ; switches D16 on. call ledd17 ; switches D17 on. call ledd18 ; switches D18 on. call ledd19 ; switches D19 on. call ledd20 ; switches D20 on. call ledd15 ; switches D15 on. return yellows call ledd6 ; switches D6 on. call ledd7 ; switches D7 on. call ledd8 ; switches D8 on. call ledd9 ; switches D9 on. call ledd10 ; switches D10 on. call ledd13 ; switches D13 on. return greens call ledd1 ; switches D1 on. call ledd2 ; switches D2 on. call ledd3 ; switches D3 on. call ledd4 ; switches D4 on. call ledd5 ; switches D5 on. call ledd14 ; switches D14 on. return resetpost3 movlw d'3' ; resets post3 by moving the No3 back into it. movwf post3 ; return ; returns from subroutine. resetpost4 movlw d'4' ; resets post4 by moving the No4 back into it. movwf post4 ; return ; returns from subroutine. resetpost5 movlw d'5' ; resets post5 by moving the No5 back into it. movwf post5 ; return ; returns from subroutine. resetpost8 movlw d'8' ; resets post8 by moving the No8 back into it. movwf post8 ; return ; returns from subroutine. resetpost18 movlw d'18' ; resets post18 by moving the No18 back into it. movwf post18 ; return ; returns from subroutine. resetpost30 movlw d'30' ; resets post30 by moving the No30 back into it. movwf post30 ; return ; returns from subroutine. resetpost40 movlw d'40' ; resets post40 by moving the No40 back into it. movwf post40 ; return ; returns from subroutine. resetpost75 movlw d'75' ; resets post75 by moving the No75 back into it. movwf post75 ; return ; returns from subroutine. ; Program Start: Start call Init Main bcf porta,4 ; clears RA4 of porta. movfw porta ; moves contents of porta into Program Counter and addwf PCL ; then skips a certain number of instructions. goto seq01 ; goto seq02 ; goto seq03 ; goto seq04 ; seq01 stary01 call ledd3 ; switches D3 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary01 ; if result is zero. Loops to stary01 if not. call resetpost40 ; stary02 call ledd3 ; switches D3 on. call ledd8 ; switches D8 on. call one952sec ; creates a 1/1952sec delay. call one952sec16 ; creates a 16/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary02 ; if result is zero. Loops to stary02 if not. call resetpost40 ; stary03 call ledd3 ; switches D3 on. call ledd8 ; switches D8 on. call ledd18 ; switches D18 on. call one952sec16 ; creates a 16/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary03 ; if result is zero. Loops to stary03 if not. call resetpost40 ; stary04 call ledd14 ; switches D14 on. call ledd13 ; switches D13 on. call ledd15 ; switches D15 on. call one952sec16 ; creates a 16/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary04 ; if result is zero. Loops to stary04 if not. call resetpost40 ; stary05 call ledd4 ; switches D4 on. call ledd9 ; switches D9 on. call ledd19 ; switches D19 on. call one952sec16 ; creates a 16/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary05 ; if result is zero. Loops to stary05 if not. call resetpost40 ; stary06 call ledd2 ; switches D2 on. call ledd7 ; switches D7 on. call ledd17 ; switches D17 on. call one952sec16 ; creates a 16/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary06 ; if result is zero. Loops to stary06 if not. call resetpost40 ; stary07 call ledd1 ; switches D1 on. call ledd6 ; switches D6 on. call ledd16 ; switches D16 on. call one952sec16 ; creates a 16/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary07 ; if result is zero. Loops to stary07 if not. call resetpost40 ; stary08 call ledd5 ; switches D5 on. call ledd10 ; switches D10 on. call ledd20 ; switches D20 on. call one952sec16 ; creates a 16/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary08 ; if result is zero. Loops to stary08 if not. call resetpost40 ; decfsz post8,f ; decrements post8 and skips the next instruction. goto stary03 ; if result is zero. Loops to stary03 if not. call resetpost8 ; places d'8' back into post8. stary09 call ledd3 ; switches D3 on. call ledd8 ; switches D8 on. call ledd18 ; switches D18 on. call one952sec16 ; creates a 16/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary09 ; if result is zero. Loops to stary09 if not. call resetpost40 ; stary10 call one952sec ; creates a 1/1952sec delay. call one952sec18 ; creates a 18/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction if zero. goto stary10 ; if result is zero. Loops to stary10 if not. call resetpost40 ; stary11 call ledd3 ; switches D3 on. call ledd2 ; switches D2 on. call one952sec ; creates a 1/1952sec delay. call one952sec16 ; creates a 16/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary11 ; if result is zero. Loops to stary11 if not. call resetpost40 ; stary12 call ledd3 ; switches D3 on. call ledd8 ; switches D8 on. call ledd7 ; switches D7 on. call ledd2 ; switches D2 on. call one952sec5 ; creates a 5/1952sec delay. call one952sec10 ; creates a 10/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction if zero. goto stary12 ; if result is zero. Loops to stary12 if not. call resetpost40 ; stary13 call ledd3 ; switches D3 on. call ledd8 ; switches D8 on. call ledd18 ; switches D18 on. call ledd2 ; switches D2 on. call ledd7 ; switches D7 on. call ledd17 ; switches D17 on. call one952sec ; creates a 1/1952sec delay. call one952sec12 ; creates a 12/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction if zero. goto stary13 ; if result is zero. Loops to stary13 if not. call resetpost40 ; stary14 call ledd14 ; switches D14 on. call ledd13 ; switches D13 on. call ledd15 ; switches D15 on. call ledd1 ; switches D1 on. call ledd6 ; switches D6 on. call ledd16 ; switches D16 on. call one952sec ; creates a 1/1952sec delay. call one952sec12 ; creates a 12/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary14 ; if result is zero. Loops to stary14 if not. call resetpost40 ; stary15 call ledd4 ; switches D4 on. call ledd9 ; switches D9 on. call ledd19 ; switches D19 on. call ledd5 ; switches D5 on. call ledd10 ; switches D10 on. call ledd20 ; switches D20 on. call one952sec ; creates a 1/1952sec delay. call one952sec12 ; creates a 12/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary15 ; if result is zero. Loops to stary15 if not. call resetpost40 ; stary16 call ledd2 ; switches D2 on. call ledd7 ; switches D7 on. call ledd17 ; switches D17 on. call ledd3 ; switches D3 on. call ledd8 ; switches D8 on. call ledd18 ; switches D18 on. call one952sec ; creates a 1/1952sec delay. call one952sec12 ; creates a 12/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary16 ; if result is zero. Loops to stary16 if not. call resetpost40 ; stary17 call ledd1 ; switches D1 on. call ledd6 ; switches D6 on. call ledd16 ; switches D16 on. call ledd14 ; switches D14 on. call ledd13 ; switches D13 on. call ledd15 ; switches D15 on. call one952sec ; creates a 1/1952sec delay. call one952sec12 ; creates a 12/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary17 ; if result is zero. Loops to stary17 if not. call resetpost40 ; stary18 call ledd5 ; switches D5 on. call ledd10 ; switches D10 on. call ledd20 ; switches D20 on. call ledd4 ; switches D4 on. call ledd9 ; switches D9 on. call ledd19 ; switches D19 on. call one952sec ; creates a 1/1952sec delay. call one952sec12 ; creates a 12/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary18 ; if result is zero. Loops to stary18 if not. call resetpost40 ; decfsz post8,f ; decrements post8 and skips the next instruction. goto stary13 ; if result is zero. Loops to stary13 if not. call resetpost8 ; places d'8' back into post8. stary19 call ledd3 ; switches D3 on. call ledd8 ; switches D8 on. call ledd18 ; switches D18 on. call ledd2 ; switches D2 on. call ledd7 ; switches D7 on. call ledd17 ; switches D17 on. call one952sec ; creates a 1/1952sec delay. call one952sec12 ; creates a 12/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary19 ; if result is zero. Loops to stary19 if not. call resetpost40 ; stary20 call one952sec ; creates a 1/1952sec delay. call one952sec18 ; creates a 18/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary20 ; if result is zero. Loops to stary20 if not. call resetpost40 ; stary21 call ledd3 ; switches D3 on. call ledd4 ; switches D4 on. call ledd1 ; switches D1 on. call one952sec16 ; creates a 16/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary21 ; if result is zero. Loops to stary21 if not. call resetpost5 ; stary22 call one952sec ; creates a 1/1952sec delay. call ledd4 ; switches D4 on. call ledd1 ; switches D1 on. call one952sec16 ; creates a 16/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary22 ; if result is zero. Loops to stary22 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary21 ; if result is zero. Loops to stary21 if not. call resetpost4 ; resets post4 register. stary23 call ledd3 ; switches D3 on. call ledd4 ; switches D4 on. call ledd1 ; switches D1 on. call ledd8 ; switches D8 on. call ledd9 ; switches D9 on. call ledd6 ; switches D6 on. call one952sec ; creates a 1/1952sec delay. call one952sec12 ; creates a 12/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary23 ; if result is zero. Loops to stary23 if not. call resetpost5 ; stary24 call one952sec ; creates a 1/1952sec delay. call ledd4 ; switches D4 on. call ledd1 ; switches D1 on. call one952sec ; creates a 1/1952sec delay. call ledd9 ; switches D9 on. call ledd6 ; switches D6 on. call one952sec ; creates a 1/1952sec delay. call one952sec12 ; creates a 12/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary24 ; if result is zero. Loops to stary24 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary23 ; if result is zero. Loops to stary23 if not. call resetpost4 ; resets post4 register. stary25 call ledd3 ; switches D3 on. call ledd8 ; switches D8 on. call ledd18 ; switches D18 on. call ledd4 ; switches D4 on. call ledd9 ; switches D9 on. call ledd19 ; switches D19 on. call ledd1 ; switches D1 on. call ledd6 ; switches D6 on. call ledd16 ; switches D16 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary25 ; if result is zero. Loops to stary25 if not. call resetpost5 ; stary26 call ledd4 ; switches D4 on. call ledd9 ; switches D9 on. call ledd19 ; switches D19 on. call ledd1 ; switches D1 on. call ledd6 ; switches D6 on. call ledd16 ; switches D16 on. call one952sec ; creates a 1/1952sec delay. call one952sec12 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary26 ; if result is zero. Loops to stary26 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary25 ; if result is zero. Loops to stary25 if not. call resetpost4 ; resets post4 register. stary27 call ledd14 ; switches D14 on. call ledd2 ; switches D2 on. call ledd5 ; switches D5 on. call ledd13 ; switches D13 on. call ledd7 ; switches D7 on. call ledd10 ; switches D10 on. call ledd15 ; switches D15 on. call ledd17 ; switches D17 on. call ledd20 ; switches D20 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary27 ; if result is zero. Loops to stary27 if not. call resetpost5 ; stary28 call one952sec ; creates a 1/1952sec delay. call ledd2 ; switches D2 on. call ledd5 ; switches D5 on. call one952sec ; creates a 1/1952sec delay. call ledd7 ; switches D7 on. call ledd10 ; switches D10 on. call one952sec ; creates a 1/1952sec delay. call ledd17 ; switches D17 on. call ledd20 ; switches D20 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary28 ; if result is zero. Loops to stary28 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary27 ; if result is zero. Loops to stary27 if not. call resetpost4 ; resets post4 register. stary29 call ledd4 ; switches D4 on. call ledd1 ; switches D1 on. call ledd3 ; switches D3 on. call ledd9 ; switches D9 on. call ledd6 ; switches D6 on. call ledd8 ; switches D8 on. call ledd19 ; switches D19 on. call ledd16 ; switches D16 on. call ledd18 ; switches D18 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary29 ; if result is zero. Loops to stary29 if not. call resetpost5 ; stary30 call one952sec ; creates a 1/1952sec delay. call ledd1 ; switches D1 on. call ledd3 ; switches D3 on. call one952sec ; creates a 1/1952sec delay. call ledd6 ; switches D6 on. call ledd8 ; switches D8 on. call one952sec ; creates a 1/1952sec delay. call ledd16 ; switches D16 on. call ledd18 ; switches D18 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary30 ; if result is zero. Loops to stary30 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary29 ; if result is zero. Loops to stary29 if not. call resetpost4 ; resets post4 register. stary31 call ledd2 ; switches D2 on. call ledd5 ; switches D5 on. call ledd14 ; switches D14 on. call ledd7 ; switches D7 on. call ledd10 ; switches D10 on. call ledd13 ; switches D13 on. call ledd17 ; switches D17 on. call ledd20 ; switches D20 on. call ledd15 ; switches D15 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary31 ; if result is zero. Loops to stary31 if not. call resetpost5 ; stary32 call one952sec ; creates a 1/1952sec delay. call ledd5 ; switches D5 on. call ledd14 ; switches D14 on. call one952sec ; creates a 1/1952sec delay. call ledd10 ; switches D10 on. call ledd13 ; switches D13 on. call one952sec ; creates a 1/1952sec delay. call ledd20 ; switches D20 on. call ledd15 ; switches D15 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary32 ; if result is zero. Loops to stary32 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary31 ; if result is zero. Loops to stary31 if not. call resetpost4 ; resets post4 register. stary33 call ledd1 ; switches D1 on. call ledd3 ; switches D3 on. call ledd4 ; switches D4 on. call ledd6 ; switches D6 on. call ledd8 ; switches D8 on. call ledd9 ; switches D9 on. call ledd16 ; switches D16 on. call ledd18 ; switches D18 on. call ledd19 ; switches D19 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary33 ; if result is zero. Loops to stary33 if not. call resetpost5 ; stary34 call one952sec ; creates a 1/1952sec delay. call ledd3 ; switches D3 on. call ledd4 ; switches D4 on. call one952sec ; creates a 1/1952sec delay. call ledd8 ; switches D8 on. call ledd9 ; switches D9 on. call one952sec ; creates a 1/1952sec delay. call ledd18 ; switches D18 on. call ledd19 ; switches D19 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary34 ; if result is zero. Loops to stary34 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary33 ; if result is zero. Loops to stary33 if not. call resetpost4 ; resets post4 register. stary35 call ledd5 ; switches D5 on. call ledd14 ; switches D14 on. call ledd2 ; switches D2 on. call ledd10 ; switches D10 on. call ledd13 ; switches D13 on. call ledd7 ; switches D7 on. call ledd20 ; switches D20 on. call ledd15 ; switches D15 on. call ledd17 ; switches D17 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary35 ; if result is zero. Loops to stary35 if not. call resetpost5 ; stary36 call one952sec ; creates a 1/1952sec delay. call ledd14 ; switches D14 on. call ledd2 ; switches D2 on. call one952sec ; creates a 1/1952sec delay. call ledd13 ; switches D13 on. call ledd7 ; switches D7 on. call one952sec ; creates a 1/1952sec delay. call ledd15 ; switches D15 on. call ledd17 ; switches D17 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary36 ; if result is zero. Loops to stary36 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary35 ; if result is zero. Loops to stary35 if not. call resetpost4 ; resets post4 register. decfsz post8,f ; decrements post8 and skips the next instruction. goto stary25 ; if result is zero. Loops to stary25 if not. call resetpost8 ; places d'8' back into post8. stary37 call ledd3 ; switches D3 on. call ledd4 ; switches D4 on. call ledd1 ; switches D1 on. call ledd8 ; switches D8 on. call ledd9 ; switches D9 on. call ledd6 ; switches D6 on. call ledd18 ; switches D18 on. call ledd19 ; switches D19 on. call ledd16 ; switches D16 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary37 ; if result is zero. Loops to stary37 if not. call resetpost5 ; stary38 call one952sec ; creates a 1/1952sec delay. call ledd4 ; switches D4 on. call ledd1 ; switches D1 on. call one952sec ; creates a 1/1952sec delay. call ledd9 ; switches D9 on. call ledd6 ; switches D6 on. call one952sec ; creates a 1/1952sec delay. call ledd19 ; switches D19 on. call ledd16 ; switches D16 on. call one952sec10 ; creates a 10/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary38 ; if result is zero. Loops to stary38 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary37 ; if result is zero. Loops to stary37 if not. call resetpost4 ; resets post4 register. stary39 call one952sec ; creates a 1/1952sec delay. call one952sec18 ; creates a 18/1952sec delay. decfsz post40,f ; decrements post40 and skips the next instruction. goto stary39 ; if result is zero. Loops to stary20 if not. call resetpost40 ; goto Main ; loops to main. seq02 stary40 call ledd11 ; switches D11 on. call ledd11 ; switches D11 on. call one952sec ; creates a 1/1952sec delay. call one952sec16 ; creates a 16/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary40 ; if result is zero. Loops to stary40 if not. call resetpost5 ; stary41 call one952sec ; creates a 1/1952sec delay. call one952sec18 ; creates a 18/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary41 ; if result is zero. Loops to stary41 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary40 ; if result is zero. Loops to stary40 if not. call resetpost4 ; resets post4 register. stary42 call ledd12 ; switches D12 on. call ledd12 ; switches D12 on. call one952sec ; creates a 1/1952sec delay. call one952sec16 ; creates a 16/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction if zero. goto stary42 ; if result is zero. Loops to stary42 if not. call resetpost5 ; stary43 call one952sec ; creates a 1/1952sec delay. call one952sec18 ; creates a 18/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction if zero. goto stary43 ; if result is zero. Loops to stary43 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction if zero. goto stary42 ; if result is zero. Loops to stary42 if not. call resetpost4 ; resets post4 register. decfsz post4a,f ; decrements post4a and skips the next instruction if zero. goto stary40 ; if result is zero. Loops to stary40 if not. movlw d'4' ; resets post4a by moving the No4 back into it. movwf post4a ; stary44 call oranges ; switches on all orange LEDs. call oranges ; switches on all orange LEDs. call one952sec ; creates a 1/1952sec delay. call one952sec6 ; creates a 6/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction if zero. goto stary44 ; if result is zero. Loops to stary44 if not. call resetpost5 ; stary45 call one952sec ; creates a 1/1952sec delay. call one952sec18 ; creates a 18/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary45 ; if result is zero. Loops to stary45 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary44 ; if result is zero. Loops to stary44 if not. call resetpost4 ; resets post4 register. stary46 call yellows ; switches on all yellow LEDs. call yellows ; switches on all yellow LEDs. call one952sec ; creates a 1/1952sec delay. call one952sec6 ; creates a 6/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary46 ; if result is zero. Loops to stary46 if not. call resetpost5 ; stary47 call one952sec ; creates a 1/1952sec delay. call one952sec18 ; creates a 18/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary47 ; if result is zero. Loops to stary47 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary46 ; if result is zero. Loops to stary46 if not. call resetpost4 ; resets post4 register. stary48 call greens ; switches on all green LEDs. call greens ; switches on all green LEDs. bcf porta,4 ; call one952sec ; creates a 1/1952sec delay. call one952sec6 ; creates a 6/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary48 ; if result is zero. Loops to stary48 if not. call resetpost5 ; stary49 call one952sec ; creates a 1/1952sec delay. call one952sec18 ; creates a 18/1952sec delay. decfsz post5,f ; decrements post5 and skips the next instruction. goto stary49 ; if result is zero. Loops to stary49 if not. call resetpost5 ; decfsz post4,f ; decrements post4 and skips the next instruction. goto stary48 ; if result is zero. Loops to stary48 if not. call resetpost4 ; resets post4 register. goto Main ; loops to main. seq03 binco01 call ledd11 ; switches D11 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco01 ; if result is zero. Loops to binco01 if not. call resetpost75 ; binco02 call ledd12 ; switches D12 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco02 ; if result is zero. Loops to binco02 if not. call resetpost75 ; binco03 call ledd11 ; switches D11 on. call oranges ; calls subroutine for turning on all orange LEDs. call one952sec12 ; creates a 12/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco03 ; if result is zero. Loops to binco03 if not. call resetpost75 ; binco04 call ledd12 ; switches D12 on. call oranges ; calls subroutine for turning on all orange LEDs. call one952sec12 ; creates a 12/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco04 ; if result is zero. Loops to binco04 if not. call resetpost75 ; binco05 call ledd11 ; switches D11 on. call yellows ; calls subroutine for turning on all yellow LEDs. call one952sec12 ; creates a 12/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco05 ; if result is zero. Loops to binco05 if not. call resetpost75 ; binco06 call ledd12 ; switches D12 on. call yellows ; calls subroutine for turning on all yellow LEDs. call one952sec12 ; creates a 12/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco06 ; if result is zero. Loops to binco06 if not. call resetpost75 ; binco07 call ledd11 ; switches D11 on. call oranges ; calls subroutine for turning on all orange LEDs. call yellows ; calls subroutine for turning on all yellow LEDs. call one952sec6 ; creates a 6/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco07 ; if result is zero. Loops to binco07 if not. call resetpost75 ; binco08 call ledd12 ; switches D12 on. call oranges ; calls subroutine for turning on all orange LEDs. call yellows ; calls subroutine for turning on all yellow LEDs. call one952sec6 ; creates a 6/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco08 ; if result is zero. Loops to binco08 if not. call resetpost75 ; binco09 call ledd11 ; switches D11 on. call greens ; calls subroutine for turning on all greens LEDs. call one952sec12 ; creates a 12/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco09 ; if result is zero. Loops to binco09 if not. call resetpost75 ; binco10 call ledd12 ; switches D12 on. call greens ; calls subroutine for turning on all greens LEDs. call one952sec12 ; creates a 12/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco10 ; if result is zero. Loops to binco10 if not. call resetpost75 ; binco11 call ledd11 ; switches D11 on. call greens ; calls subroutine for turning on all greens LEDs. call oranges ; calls subroutine for turning on all oranges LEDs. call one952sec6 ; creates a 6/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco11 ; if result is zero. Loops to binco11 if not. call resetpost75 ; binco12 call ledd12 ; switches D12 on. call greens ; calls subroutine for turning on all greens LEDs. call oranges ; calls subroutine for turning on all oranges LEDs. call one952sec6 ; creates a 6/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco12 ; if result is zero. Loops to binco12 if not. call resetpost75 ; binco13 call ledd11 ; switches D11 on. call greens ; calls subroutine for turning on all green LEDs. call yellows ; calls subroutine for turning on all yellow LEDs. call one952sec6 ; creates a 6/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco13 ; if result is zero. Loops to binco13 if not. call resetpost75 ; binco14 call ledd12 ; switches D12 on. call greens ; calls subroutine for turning on all green LEDs. call yellows ; calls subroutine for turning on all yellow LEDs. call one952sec6 ; creates a 6/1952sec delay. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco14 ; if result is zero. Loops to binco14 if not. call resetpost75 ; binco15 call ledd11 ; switches D11 on. call greens ; calls subroutine for turning on all green LEDs. call yellows ; calls subroutine for turning on all yellow LEDs. call oranges ; calls subroutine for turning on all orange LEDs. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco15 ; if result is zero. Loops to binco15 if not. call resetpost75 ; binco16 call ledd12 ; switches D12 on. call greens ; calls subroutine for turning on all green LEDs. call yellows ; calls subroutine for turning on all yellow LEDs. call oranges ; calls subroutine for turning on all orange LEDs. decfsz post75,f ; decrements post75 and skips the next instruction. goto binco16 ; if result is zero. Loops to binco16 if not. call resetpost75 ; goto Main ; loops to main. seq04 ransq01 call ledd1 ; switches D1 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq01 ; if result is zero. Loops to ransq01 if not. call resetpost18 ; ransq02 call ledd2 ; switches D2 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq02 ; if result is zero. Loops to ransq02 if not. call resetpost18 ; ransq03 call ledd3 ; switches D3 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq03 ; if result is zero. Loops to ransq03 if not. call resetpost18 ; ransq04 call ledd4 ; switches D4 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq04 ; if result is zero. Loops to ransq04 if not. call resetpost18 ; ransq05 call ledd6 ; switches D6 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq05 ; if result is zero. Loops to ransq05 if not. call resetpost18 ; ransq06 call ledd7 ; switches D7 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq06 ; if result is zero. Loops to ransq06 if not. call resetpost18 ; ransq07 call ledd8 ; switches D8 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq07 ; if result is zero. Loops to ransq07 if not. call resetpost18 ; ransq08 call ledd9 ; switches D9 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq08 ; if result is zero. Loops to ransq08 if not. call resetpost18 ; ransq09 call ledd11 ; switches D11 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq09 ; if result is zero. Loops to ransq09 if not. call resetpost18 ; ransq10 call ledd12 ; switches D12 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq10 ; if result is zero. Loops to ransq10 if not. call resetpost18 ; ransq11 call ledd13 ; switches D13 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq11 ; if result is zero. Loops to ransq11 if not. call resetpost18 ; ransq12 call ledd14 ; switches D14 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq12 ; if result is zero. Loops to ransq12 if not. call resetpost18 ; ransq13 call ledd16 ; switches D16 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq13 ; if result is zero. Loops to ransq13 if not. call resetpost18 ; ransq14 call ledd17 ; switches D17 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq14 ; if result is zero. Loops to ransq14 if not. call resetpost18 ; ransq15 call ledd18 ; switches D18 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq15 ; if result is zero. Loops to ransq15 if not. call resetpost18 ; ransq16 call ledd19 ; switches D19 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq16 ; if result is zero. Loops to ransq16 if not. call resetpost18 ; ransq17 call ledd5 ; switches D5 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq17 ; if result is zero. Loops to ransq17 if not. call resetpost18 ; ransq18 call ledd10 ; switches D10 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq18 ; if result is zero. Loops to ransq18 if not. call resetpost18 ; ransq19 call ledd15 ; switches D15 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq19 ; if result is zero. Loops to ransq19 if not. call resetpost18 ; ransq20 call ledd20 ; switches D20 on. call one952sec18 ; creates a 18/1952sec delay. decfsz post18,f ; decrements post18 and skips the next instruction. goto ransq20 ; if result is zero. Loops to ransq20 if not. call resetpost18 ; goto Main ; loops to main. END